<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title th:text="${type.typeName}"></title>
  	
		<div th:include="wechat/include/exportStatic :: static"></div>
    <link rel="stylesheet" type="text/css" href="../css/carpool.css">
</head>
<body>
    <div class="carpool">
        <main>
        <section class="tap-menu" th:if="${#lists.size(type.childTypes)} ne 0">
         	<div class="tap-menu-item" th:each="type : ${type.childTypes}" th:id="${type.id}" th:text="${type.typeName}"
                 th:onclick="'javascript:changePost(\''+${type.id}+'\',\''+${type.pid}+'\')'"></div>
        </section>
        <div class="driver-list" th:each="type : ${type.childTypes}" th:data-id="${type.id}" ></div>
        <div class="driver-detail" th:data-id="${type.id}" th:if="${#lists.size(type.childTypes)} eq 0">
        </div>
        
        
        
          <!--   <section class="tap-menu" th:if="${#lists.size(type.childTypes)} ne 0">
                <div class="tap-menu-item" th:each="type : ${type.childTypes}" th:id="${type.id}" th:text="${type.typeName}"
                 th:onclick="'javascript:changePost(\''+${type.id}+'\',\''+${type.pid}+'\')'"></div>
            </section>
            <div class="driver-list" th:each="type : ${type.childTypes}" th:data-id="${type.id}" th:if="${#lists.size(type.childTypes)} ne 0"></div>
            <div class="driver-list" data-id="" th:if="${#lists.size(type.childTypes)} eq 0">
            </div> -->
        </main>
    </div>
    <script>
        // 适配
        var scale = 1 / window.devicePixelRatio
        document.querySelector('meta[name="viewport"]')
            .setAttribute('content', 'width=device-width,initial-scale=' + scale + ', user-scalable=no')

        document.documentElement.style.fontSize = document.documentElement.clientWidth / 10 + 'px';
        var _id;
        var _pid;
        $(function(){
        	$('.tap-menu-item').first().addClass('active');
        	
        	$('.active').click();
        	
        	
        })
        function changePost(id,pid){
        	_id = id;
        	_pid = pid;
        	$('.tap-menu-item').removeClass('active');
        	$('#'+id).addClass('active');
   			$('.driver-list').hide();
   			$('.driver-list[data-id=' + id + ']').show();
        	if($('.driver-list[data-id=' + id + ']').text() != ''){
        		return false;
        	}
        	$('.driver-list[data-id=' + id + ']').html("<div class='loading-list'>正在加载...</div>");
        	$.ajax({
        		url: '/wechat/list',
        		success: function(html){
        			$('.driver-list[data-id=' + id + ']').html(html);
        		}
        	
        	})
        }

    </script>
</body>
</html>